﻿using ByteSite.Quartz;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Topshelf;

namespace ByteSite.Service
{
    class Program
    {
        static void Main(string[] args)
        {
            HostFactory.Run(config =>
            {
                config.Service<QuartzHelper>(setting =>
                {
                    setting.ConstructUsing(name => new QuartzHelper());
                    setting.WhenStarted(tc => tc.Start().GetAwaiter());
                    setting.WhenStopped(tc => tc.Stop());
                });

                //服务使用NETWORK_SERVICE内置帐户运行。身份标识，有好几种方式，如：x.RunAs("username", "password");  x.RunAsPrompt(); x.RunAsNetworkService(); 等
                config.RunAsLocalSystem();

                config.SetDescription("ByteSite服务,用于站点的定时任务及站点检测");  //服务的描述
                config.SetDisplayName("ByteSite定时服务");      //安装显示名称
                config.SetServiceName("ByteSiteService");     //安装服务名称
            });
        }
    }
}
